/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package database;

import java.sql.Connection;
import java.sql.Statement;
import javax.swing.JOptionPane;

/**
 *
 * @author BENY as User
 */
import oracle.jdbc.pool.OracleDataSource;

public class buat_tabel {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        String url = "jdbc:oracle:thin:@localhost:1521:XE";
        String name = "hr";
        String pass = "sisil";
        Connection con;


        try {
            OracleDataSource ods = new OracleDataSource();
            ods.setURL(url);
            con = ods.getConnection(name, pass);
            Statement stat = con.createStatement();
            String surat = "create table SURAT (NO_SURAT varchar2(100), " + "PERIHAL varchar2(100)," + "ASAL_SURAT varchar2(100),"
                    + "PENERIMA varchar2 (120)," + "LETAK_SURAT varchar2(112)," + "PETUGAS_PENERIMA_SURAT varchar2(100),"
                    + "TANGGAL varchar2(85)," + "KETERANGAN varchar2(100))";
            stat.executeQuery(surat);
            String dokument = "create table DOKUMEN (NO_DOKUMEN varchar2(100), " + "PERIHAL varchar2(100)," + "ASAL_DOKUMEN varchar2(100),"
                    + "PENERIMA varchar2(120)," + "LETAK_DOKUMEN varchar2(112)," + "PETUGAS_PENERIMA_DOKUMEN varchar2(100),"
                    + "TANGGAL varchar2(85)," + "KETERANGAN varchar2(100))";
            stat.executeQuery(dokument);
            String dosen = "create table DOSEN(NIP varchar2(10)," + "ALAMAT varchar2(100),"
                    + "PENERIMA varchar2(120))";
            stat.executeQuery(dosen);
            String cache = "create table CACHE(DATA varchar2(20))";
            stat.executeQuery(cache);
            JOptionPane.showMessageDialog(null, "tabel berhasil dibuat");
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "eror" + e.getMessage());


        }
    }
}
